From d733078766a8081dbbc49089198df805d3d8d728 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Sun, 14 Apr 2019 20:29:14 +0100 Subject: [PATCH] ci: Style the test report My web design skills are terrible, but it's better than nothing; I'm sure this will lead to somebody filing a merge request to make the test report look a lot better. While we're at it, let's include the reftest images inside the report itself, so we don't have to hunt them down. --- .gitlab-ci/meson-html-report.py | 136 +++++++++++++++++++++++++++++++- .gitlab-ci/test-docker.sh | 1 + 2 files changed, 133 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci/meson-html-report.py b/.gitlab-ci/meson-html-report.py index dd750a775b..77832d8af7 100755 --- a/.gitlab-ci/meson-html-report.py +++ b/.gitlab-ci/meson-html-report.py @@ -17,6 +17,97 @@ REPORT_TEMPLATE = ''' {{ report.project_name }} Test Report +
@@ -49,14 +140,33 @@ REPORT_TEMPLATE = '''
  • Passed: {{ suite_result.n_successes }}
  • Failed: {{ suite_result.n_failures }}
  • + +
    +

    Passed

    +
      + {% for success in suite_result.successes %} +
    • {{ success.name }}
    • + {% endfor %} +
    +
    + {% for failure in suite_result.failures %} {% if loop.first %} -
    -

    Failures

    -
      +
      +

      Failed

      +
        {% endif %}
      • {{ failure.name }} - result: {{ failure.result }}
        -
        {{ failure.stdout }}
        + {% if failure.stdout %} + Output:
        {{ failure.stdout }}
        + {% endif %} + {% if failure.image_data is defined %} +
          +
        • ref
        • +
        • out
        • +
        • diff
        • +
        + {% endif %}
      • {% if loop.last %}
      @@ -86,6 +196,12 @@ aparser.add_argument('--output', metavar='FILE', help='The output HTML file, stdout by default', type=argparse.FileType('w', encoding='UTF-8'), default=sys.stdout) +aparser.add_argument('--reftest-suite', metavar='NAME', + help='The name of the reftests suite', + default='reftest') +aparser.add_argument('--reftest-output-dir', metavar='DIR', + help='The output directory for reftests data', + default=None) aparser.add_argument('infile', metavar='FILE', help='The input testlog.json, stdin by default', type=argparse.FileType('r', encoding='UTF-8'), @@ -111,6 +227,18 @@ for line in args.infile: 'stdout': data['stdout'], } + if args.reftest_output_dir is not None and suite_name == args.reftest_suite: + filename = unit_name.split(' ')[1] + basename = os.path.splitext(filename)[0] + + image_data = { + 'ref': os.path.join(args.reftest_output_dir, '{}.ref.png'.format(basename)), + 'out': os.path.join(args.reftest_output_dir, '{}.out.png'.format(basename)), + 'diff': os.path.join(args.reftest_output_dir, '{}.diff.png'.format(basename)), + } + + unit['image_data'] = image_data + units = suites.setdefault(full_suite, []) units.append(unit) diff --git a/.gitlab-ci/test-docker.sh b/.gitlab-ci/test-docker.sh index 45de67000a..05d7c3a45c 100755 --- a/.gitlab-ci/test-docker.sh +++ b/.gitlab-ci/test-docker.sh @@ -47,6 +47,7 @@ $srcdir/.gitlab-ci/meson-junit-report.py \ $srcdir/.gitlab-ci/meson-html-report.py \ --project-name=GTK \ --job-id="${CI_JOB_NAME}" \ + --reftest-output-dir="testsuite/reftests/output" \ --output=report.html \ meson-logs/testlog.json -- 2.30.2